<?php

namespace App\Ordersys\Providers;

use App\Ordersys\Contracts\OrderanalysisInterface;
use App\Ordersys\Contracts\OrderApplyInterface;
use App\Ordersys\Contracts\OrdersysChannelInterface;
use App\Ordersys\Contracts\OrdersysCircleFriendsInterface;
use App\Ordersys\Contracts\OrdersysCustomerInterface;
use App\Ordersys\Contracts\OrdersysGoodsClassInterface;
use App\Ordersys\Contracts\OrdersysGoodsInterface;
use App\Ordersys\Contracts\OrdersysOrderInterface;
use App\Ordersys\Contracts\OrdersysPaytypeInterface;
use App\Ordersys\Contracts\OrdersysShippingInterface;
use App\Ordersys\Contracts\WxuserInterface;
use App\Ordersys\Repositories\DbOrderanalysisRepository;
use App\Ordersys\Repositories\DbOrderApplyRepository;
use App\Ordersys\Repositories\DbOrdersysChannelRepository;
use App\Ordersys\Repositories\DbOrdersysCircleFriendsRepository;
use App\Ordersys\Repositories\DbOrdersysCustomerRepository;
use App\Ordersys\Repositories\DbOrdersysGoodsClassRepository;
use App\Ordersys\Repositories\DbOrdersysGoodsRepository;
use App\Ordersys\Repositories\DbOrdersysOrderRepository;
use App\Ordersys\Repositories\DbOrdersysPaytypeRepository;
use App\Ordersys\Repositories\DbOrdersysShippingRepository;
use App\Ordersys\Repositories\DbWxuserRepository;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;


class OrdersysProvider extends ServiceProvider
{
    protected $admin_namespace = 'App\Ordersys\Controllers\Admin';
    protected $home_namespace = 'App\Ordersys\Controllers\Home';
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //后台管理
        Route::middleware('web')
            ->namespace($this->admin_namespace)
            ->group(__DIR__ . "/../admin_routes.php");
        //前台管理
        Route::middleware('web')
            ->namespace($this->home_namespace)
            ->group(__DIR__ . "/../routes.php");
//        require __DIR__.'/../routes.php';
//        require __DIR__.'/../admin_routes.php';
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(OrdersysOrderInterface::class, DbOrdersysOrderRepository::class); //文章管理
        $this->app->bind(OrdersysCircleFriendsInterface::class, DbOrdersysCircleFriendsRepository::class); //朋友圈管理
        $this->app->bind(OrdersysGoodsInterface::class, DbOrdersysGoodsRepository::class); //产品管理
        $this->app->bind(OrdersysShippingInterface::class, DbOrdersysShippingRepository::class); //快递
        $this->app->bind(WxuserInterface::class, DbWxuserRepository::class); //微信号
        $this->app->bind(OrdersysPaytypeInterface::class, DbOrdersysPaytypeRepository::class); //支付方式
        $this->app->bind(OrdersysGoodsClassInterface::class, DbOrdersysGoodsClassRepository::class); //产品分类
        $this->app->bind(OrdersysCustomerInterface::class, DbOrdersysCustomerRepository::class); //用户
        $this->app->bind(OrderApplyInterface::class, DbOrderApplyRepository::class); //订单管理
        $this->app->bind(OrderanalysisInterface::class, DbOrderanalysisRepository::class); //统计操作
        $this->app->bind(OrdersysChannelInterface::class, DbOrdersysChannelRepository::class); //统计操作
    }
}
